<?php
namespace App\Controllers;

use Framework\Database;

class HomeController
{
    public $db;
    public function __construct()
    {
        $config = require basePath('config\db.php');

        $this->db = new Database($config);
    }
    /**
     * 展示最新岗位
     * @return void
     */
    public function index()
    {
        $listings = $this->db->query('SELECT*FROM listing ORDER BY created_at DESC LIMIT 6')->fetchAll();
        loadView('home', [
            'listings' => $listings
        ]);
    }
}